<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>编辑文章</title>
    <link rel="stylesheet" href="./libs/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/iconfont.css">
    <link rel="stylesheet" href="./css/main.css">
    <!-- jq -->
    <script src="./libs/jquery/jquery.min.js"></script>
</head>

<body>
    <div class="container-fluid">
        <div class="common_title">
            编辑文章
        </div>
        <div class="container-fluid common_con">
            <form class="form-horizontal article_form" id="form">

            </form>
        </div>
    </div>

    <script type="text/html" id='articleForm'>
        {{each data}}
        <div class="form-group">
            <label for="inputTitle" class="col-sm-2 control-label">文章标题：</label>
            <div class="col-sm-10">
                <input type="text" name="title" class="form-control title" id="inputTitle" value={{$value.title}}>
            </div>
        </div>
        <div class="form-group">
            <label for="inputCover" class="col-sm-2 control-label">文章封面：</label>
            <div class="col-sm-10">
                <img src={{$value.cover}} class="article_cover">
                <input name="cover" type="file" id="inputCover" onchange="changeCoverImage()">
            </div>
        </div>
        <div class="form-group">
            <label for="inputCategory" class="col-sm-2 control-label">文章类别：</label>
            <div class="col-sm-4">
                <select id="category" class="form-control category" name="categoryId" value={{$value.categoryId}}>
                    <option value="" {{ $value.categoryId =='' ? 'selected' :'' }}>未分类</option>
                    <option value="1" {{ $value.categoryId == '1' ? 'selected' :'' }}>奇趣事</option>
                    <option value="2" {{ $value.categoryId == '2' ? 'selected' :'' }}>会生活</option>
                    <option value="3" {{ $value.categoryId == '3' ? 'selected' :'' }}>爱旅行</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">发布时间：</label>
            <div class="col-sm-4">
                <input id="articleDate" name='date' class="jeinput" type="text" placeholder="请选择发布日期" readonly>
            </div>
        </div>
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">文章内容：</label>
            <div class="col-sm-10">
                <!-- 富文本编辑区域 -->
                <textarea id="articleContent">{{$value.content}}</textarea>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-success btn-edit" onclick="return saveArticle('已发布')">修改</button>
                <button type="submit" class="btn btn-default btn-draft" onclick="return saveArticle('草稿')">存为草稿</button>
            </div>
        </div>
        {{/each}}
    </script>

    <script src="../js/template-web.js"></script>
    <script src="./js/api.js"></script>
    <script src="./js/article_edit.js"></script>
</body>

</html>